package HP.p0905;

public class Student {
    private int age;

    public int getAge() {
        return age;
    }

    public void setAge(int age) throws Exception {
        if (age >= 18 && age <= 60) {
            this.age = age;
        } else {
            throw new Exception("年龄无效!");
        }
    }
}
